import java.util.Scanner;

public class Test7 {
    public static void main(String[] args) {
        //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
        Scanner scan=new Scanner(System.in);
        int num=scan.nextInt();
        //输出奇数位
        for (int i = 30; i >=0 ; i-=2) {
            System.out.print( ( (num >> i) & 1 )+ " " );
        }
        System.out.println();//换行
        //输出奇数位
        for (int i = 31; i >=0 ; i-=2) {
            System.out.print( ( (num >> i) & 1 )+ " " );
        }
    }
}
